<template>
  <div>
    <div class="table-body">
      <el-table :data="tableData" border v-loading="isLoading" style="width: 100%">
        <el-table-column prop="name" label="订单编号"></el-table-column>
        <el-table-column prop="money" label="金额"></el-table-column>
        <el-table-column prop="createTime" label="创建时间"></el-table-column>
        <el-table-column prop="sourceType" label="订单来源"></el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination
          background
          @current-change="currentPageChange"
          layout="prev, pager, next"
          :total="total"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "",
  data() {
    return {
      tableData: [],
      isLoading: false,
      total: 1,
      param: {
        membershipLevelCustomer: {
          customerId:"",
          status: 3
        },
        queryRequest: {
          pageNum: 1,
          pageSize: 10
        }
      }
    };
  },
  props: ["data"],
  components: {},
  computed: {},
  beforeMount() {},
  mounted() {
      this.param.membershipLevelCustomer.customerId = this.data.customerId;
      this.initData();
  },
  methods: {
      initData() {
      this.$service.getRechargeList(this.param).then(res => {
        this.isLoading = false;
        if (res.code == "00000") {
          if (
            res.data.records.length == 0 &&
            this.param.queryRequest.pageNum != 1
          ) {
            this.param.queryRequest.pageNum -= 1;
            this.initData();
          }
          this.tableData = res.data.records;
          this.total = res.data.total || 0;
        }
      });
    },
    currentPageChange(e) {
        this.param.queryRequest.pageNum =e;
        this.initData();
    }
  },
  watch: {}
};
</script>
<style scoped>
</style>
